home *** CD-ROM | disk | FTP | other *** search
/ Champak 103 / Vol 103.iso / games / scuba.swf / scripts / frame_18 / PlaceObject2_117_156 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2010-03-13  |  2KB  |  50 lines

  1. onClipEvent(enterFrame){
  2.    if(status == "active" && this._x >= _root.RIGHT_BOUND)
  3.    {
  4.       if(_root.coral.hitTest(this._x,this._y,true) == true)
  5.       {
  6.          vSideOfImpact = "undetermined";
  7.          vPixelCounter = Number(1);
  8.          while(vSideOfImpact == "undetermined")
  9.          {
  10.             if(_root.coral.hitTest(this._x,Number(this._y + Number(vPixelCounter)),true) == false && Number(this._y + Number(vPixelCounter)) < _root.BOTTOM_BOUND)
  11.             {
  12.                vSideOfImpact = "top";
  13.                vPixelOffset = vPixelCounter + Number(this._height) * 2;
  14.             }
  15.             else if(_root.coral.hitTest(this._x,Number(this._y - Number(vPixelCounter)),true) == false && _root.TOP_BOUND < Number(this._y - Number(vPixelCounter)))
  16.             {
  17.                vSideOfImpact = "bottom";
  18.                vPixelOffset = vPixelCounter + Number(this._height) * 2;
  19.             }
  20.             vPixelCounter++;
  21.          }
  22.          if(vSideOfImpact == "top")
  23.          {
  24.             setProperty(this, _Y, Number(this._y + Number(vPixelOffset)));
  25.          }
  26.          else if(vSideOfImpact == "bottom")
  27.          {
  28.             setProperty(this, _Y, Number(this._y - Number(vPixelOffset)));
  29.          }
  30.       }
  31.    }
  32.    else if(status == "active" && this._x < _root.RIGHT_BOUND)
  33.    {
  34.       if(_root.recruit.diver.hitTest(this._x,this._y,false) == true && hit != true)
  35.       {
  36.          _root.fnTakeOxygen();
  37.          hit = true;
  38.          this.gotoAndPlay("takeoxygen");
  39.       }
  40.       else if(hit == true)
  41.       {
  42.          if(this._x < _root.LEFT_BOUND)
  43.          {
  44.             hit = false;
  45.             this.gotoAndPlay("loop");
  46.          }
  47.       }
  48.    }
  49. }
  50.